% fig7 混沌吸引子图(Attractor)
clear; clc; close all;

%% —— 参数设置 —— 
g11 = 2; g12 = 2; g21 = -2; g22 = 2;   % 连接权重
mu  = 0.8;                             % 画 (b) 子图
x0  = 0.1;  y0 = 0.1;                  % 初始值
color = [1,0,1];                       % magenta

Niter  = 500000;   % 总迭代步数
Ntrans = 10000;    % 丢弃热身步数

%% —— 迭代轨迹 —— 
x = x0;  y = y0;
traj = zeros(Niter - Ntrans, 2);
idx = 0;
for k = 1:Niter
    x_next = mu*x + g11*sin(x) + g12*sin(y);
    y_next = mu*y + g21*sin(x) + g22*sin(y);
    x = x_next;  y = y_next;
    if k > Ntrans
        idx = idx + 1;
        traj(idx,:) = [x, y];
    end
end

%% —— 绘图 —— 
figure;
plot(traj(:,1), traj(:,2), '.', 'Color', color, 'MarkerSize', 1);
xlabel('x','FontSize',12);
ylabel('y','FontSize',12);
title(sprintf('\\mu = %.2f 的混沌吸引子', mu), 'FontSize',14);
axis equal;
grid on;